//
//  YXRegistView.m
//  跑跑快销
//
//  Created by 杨潇 on 14-4-28.
//  Copyright (c) 2014年 ylife. All rights reserved.
//

#import "YXRegistView.h"

@implementation YXRegistView
@synthesize inputNumberText,yLifeText,inputAuthCodeText,inputPasswordText,affirmPasswordText,nameTf,getAuthCodeBtn,backButton,nextBtn,selectBtn,affirmRegisterBtn,inputAuthCodeScroll;

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        self.backgroundColor = [UIColor grayColor];
        
        [self createUI];

    }
    return self;
}

#pragma mark - CreateUI
- (void)createUI
{
    if (ISDEVICE7) {
        pageTitleLabelY = 60;
        upViewY = 120;
    }else{
        pageTitleLabelY = 40;
        upViewY = 100;
    }
    pageTitleLabel[0] = [[UILabel alloc] initWithFrame:CGRectMake(30, pageTitleLabelY, 65, 15)];
    pageTitleLabel[0].text = @"输入手机号";
    pageTitleLabel[0].font = [UIFont systemFontOfSize:13];
    [self addSubview:pageTitleLabel[0]];
    
    pageTitleLabel[1] = [[UILabel alloc] initWithFrame:CGRectMake(110, pageTitleLabelY, 110, 15)];
    pageTitleLabel[1].text = @"输入验证码及密码";
    pageTitleLabel[1].font = [UIFont systemFontOfSize:13];
    [self addSubview:pageTitleLabel[1]];
    
    pageTitleLabel[2] = [[UILabel alloc] initWithFrame:CGRectMake(235, pageTitleLabelY, 55, 15)];
    pageTitleLabel[2].text = @"选择行业";
    pageTitleLabel[2].font = [UIFont systemFontOfSize:13];
    [self addSubview:pageTitleLabel[2]];
    
    [self createUpView1];
}

- (void)createUpView1
{
    upView[0] = [[UIView alloc] initWithFrame:CGRectMake(10, upViewY, 300, 360)];
    upView[0].backgroundColor = [UIColor clearColor];
    [self addSubview:upView[0]];
    
    inputNumberText = [[UITextField alloc] initWithFrame:CGRectMake(0, 100, 300, 40)];
    inputNumberText.borderStyle = UITextBorderStyleRoundedRect;
    inputNumberText.keyboardType = UIKeyboardTypePhonePad;
    inputNumberText.placeholder = @"输入手机号码";
    [upView[0] addSubview:inputNumberText];
    
    getAuthCodeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    getAuthCodeBtn.frame = CGRectMake(0, inputNumberText.frame.origin.y + 40 + 20, 300, 40);
    getAuthCodeBtn.backgroundColor = [UIColor redColor];
    [getAuthCodeBtn setTitle:@"获取验证码" forState:UIControlStateNormal];
    [upView[0] addSubview:getAuthCodeBtn];
    
    backButton = [UIButton buttonWithType:UIButtonTypeCustom];
    backButton.frame = CGRectMake(0, 300, 300, 40);
    backButton.backgroundColor = [UIColor redColor];
    [backButton setTitle:@"返回登录" forState:UIControlStateNormal];
    [upView[0] addSubview:backButton];
}

- (void)createUpView2
{
    [upView[0] removeFromSuperview];
    upView[1] = [[UIView alloc] initWithFrame:CGRectMake(10, upViewY, 300, 360)];
    upView[1].backgroundColor = [UIColor lightGrayColor];
    [self addSubview:upView[1]];
    
    inputAuthCodeScroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 300, 360)];
    inputAuthCodeScroll.contentSize = CGSizeMake(300, 310);
    [upView[1] addSubview:inputAuthCodeScroll];
    
    UILabel * remainderLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 300, 70)];
    remainderLabel.lineBreakMode = NSLineBreakByWordWrapping;
    remainderLabel.numberOfLines = 0;
    remainderLabel.text = @"请输入正式版的公司激活码，如果没有激活码，我们给您提供一个测试激活码，使用测试激活码的账户，一个月后将会过期，您可以随时在软件设置里面更换正式激活码。";
    remainderLabel.font = [UIFont systemFontOfSize:13];
    [inputAuthCodeScroll addSubview:remainderLabel];
    
    int textH = 40;
    int gap = 10;
    yLifeText = [[UITextField alloc] initWithFrame:CGRectMake(0, remainderLabel.frame.origin.y + remainderLabel.frame.size.height, 300, textH)];
    yLifeText.borderStyle = UITextBorderStyleRoundedRect;
    yLifeText.placeholder = @"输入激活码";
    [inputAuthCodeScroll addSubview:yLifeText];
    
    inputAuthCodeText = [[UITextField alloc] initWithFrame:CGRectMake(0,yLifeText.frame.origin.y + textH + gap, 300, textH)];
    inputAuthCodeText.borderStyle = UITextBorderStyleRoundedRect;
    inputAuthCodeText.placeholder = @"输入短信验证码";
    inputAuthCodeText.keyboardType = UIKeyboardTypeAlphabet;
    [inputAuthCodeScroll addSubview:inputAuthCodeText];
    
    inputPasswordText = [[UITextField alloc] initWithFrame:CGRectMake(0, inputAuthCodeText.frame.origin.y + textH + gap, 300, textH)];
    inputPasswordText.placeholder = @"输入密码";
    inputPasswordText.borderStyle = UITextBorderStyleRoundedRect;
    inputPasswordText.keyboardType = UIKeyboardTypeAlphabet;
    inputPasswordText.secureTextEntry = YES;
    [inputAuthCodeScroll addSubview:inputPasswordText];
    
    affirmPasswordText = [[UITextField alloc] initWithFrame:CGRectMake(0, inputPasswordText.frame.origin.y + textH + gap, 300, textH)];
    affirmPasswordText.placeholder = @"确认密码";
    affirmPasswordText.borderStyle = UITextBorderStyleRoundedRect;
    affirmPasswordText.keyboardType = UIKeyboardTypeAlphabet;
    affirmPasswordText.secureTextEntry = YES;
    [inputAuthCodeScroll addSubview:affirmPasswordText];
    
    nextBtn = [UIButton buttonWithType:UIButtonTypeSystem];
    nextBtn.layer.masksToBounds = YES;
    nextBtn.layer.cornerRadius = 10;
    nextBtn.backgroundColor = [UIColor redColor];
    nextBtn.frame = CGRectMake(0, affirmPasswordText.frame.origin.y + textH + gap, 300, textH);
    [nextBtn setTitle:@"下一步" forState:UIControlStateNormal];
    [inputAuthCodeScroll addSubview:nextBtn];
}

- (void)createUpView3
{
    [upView[1] removeFromSuperview];
    upView[2] = [[UIView alloc] initWithFrame:CGRectMake(10, upViewY, 300, 360)];
    upView[2].backgroundColor = [UIColor clearColor];
    [self addSubview:upView[2]];
    
    nameTf = [[UITextField alloc] initWithFrame:CGRectMake(0, 20, 300, 40)];
    nameTf.borderStyle = UITextBorderStyleRoundedRect;
    nameTf.placeholder = @"输入用户名称";
    [upView[2] addSubview:nameTf];
    
    selectBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    selectBtn.frame = CGRectMake(0, nameTf.frame.origin.y + nameTf.frame.size.height + 20, 300, 40);
    selectBtn.backgroundColor = [UIColor whiteColor];
    [selectBtn setTitle:@"选择行业" forState:UIControlStateNormal];
    [upView[2] addSubview:selectBtn];
    
    affirmRegisterBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    affirmRegisterBtn.frame = CGRectMake(0, selectBtn.frame.origin.y + selectBtn.frame.size.height + 50, 300, 40);
    affirmRegisterBtn.backgroundColor = [UIColor whiteColor];
    [affirmRegisterBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [affirmRegisterBtn setTitle:@"确认注册" forState:UIControlStateNormal];
    [upView[2] addSubview:affirmRegisterBtn];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end
